第二回実技検定 C - 山崩し
https://atcoder.jp/contests/past202004-open/tasks/past202004_c
提出
code: python
n = int(input())
s =
list(input()) for _ in range(n)
for i in range(n-2, -1, -1):
for j in range(2*n - 2, -1, -1):
if (s
i
j
== "."):
continue
if (j == 2*n - 2):
if (s
i+1
j
== "X" or s
i+1
j-1
== "X"):
s
i
j
= "X"
elif (j == 0):
if (s
i+1
j
== "X" or s
i+1
j+1
== "X"):
s
i
j
= "X"
else:
if (s
i+1
j-1
== "X" or s
i+1
j
== "X" or s
i+1
j+1
== "X"):
s
i
j
= "X"
for i in s:
print("".join(i))
テーマ
#coordinate